from operator import xor
from typing import *


class Solution:
    def subsetXORSum(self, nums: List[int]) -> int:
        ans, n = 0, len(nums)
        for i in range(1 << n):
            _xor = 0
            for j in range(n):
                if i & (1 << j) > 0:
                    _xor ^= nums[j]
            ans += _xor
        return ans



